<?php

/**
 * Empresa filter form base class.
 *
 * @package    Sanitas
 * @subpackage filter
 * @author     Jose Antonio Sánchez Bedoya
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseEmpresaFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'cif'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'nombre'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'direccion_linea1' => new sfWidgetFormFilterInput(),
      'direccion_linea2' => new sfWidgetFormFilterInput(),
      'cp'               => new sfWidgetFormFilterInput(),
      'poblacion'        => new sfWidgetFormFilterInput(),
      'provincia'        => new sfWidgetFormFilterInput(),
      'telefono'         => new sfWidgetFormFilterInput(),
      'fax'              => new sfWidgetFormFilterInput(),
      'web'              => new sfWidgetFormFilterInput(),
      'email'            => new sfWidgetFormFilterInput(),
      'logo'             => new sfWidgetFormFilterInput(),
      'descripcion'      => new sfWidgetFormFilterInput(),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'validated_at'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'is_validated'     => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'removed_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'remove_it'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
    ));

    $this->setValidators(array(
      'cif'              => new sfValidatorPass(array('required' => false)),
      'nombre'           => new sfValidatorPass(array('required' => false)),
      'direccion_linea1' => new sfValidatorPass(array('required' => false)),
      'direccion_linea2' => new sfValidatorPass(array('required' => false)),
      'cp'               => new sfValidatorPass(array('required' => false)),
      'poblacion'        => new sfValidatorPass(array('required' => false)),
      'provincia'        => new sfValidatorPass(array('required' => false)),
      'telefono'         => new sfValidatorPass(array('required' => false)),
      'fax'              => new sfValidatorPass(array('required' => false)),
      'web'              => new sfValidatorPass(array('required' => false)),
      'email'            => new sfValidatorPass(array('required' => false)),
      'logo'             => new sfValidatorPass(array('required' => false)),
      'descripcion'      => new sfValidatorPass(array('required' => false)),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'validated_at'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'is_validated'     => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'removed_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'remove_it'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
    ));

    $this->widgetSchema->setNameFormat('empresa_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Empresa';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'cif'              => 'Text',
      'nombre'           => 'Text',
      'direccion_linea1' => 'Text',
      'direccion_linea2' => 'Text',
      'cp'               => 'Text',
      'poblacion'        => 'Text',
      'provincia'        => 'Text',
      'telefono'         => 'Text',
      'fax'              => 'Text',
      'web'              => 'Text',
      'email'            => 'Text',
      'logo'             => 'Text',
      'descripcion'      => 'Text',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
      'validated_at'     => 'Date',
      'is_validated'     => 'Boolean',
      'removed_at'       => 'Date',
      'remove_it'        => 'Boolean',
    );
  }
}
